<?php
  include("../conn.php");
  $id = $_GET['id'];
  if ($id == null) $sql = "SELECT * FROM `issue_list` order by id desc limit 8";
  else $sql = "SELECT * FROM `issue_list` where `id` < '$id' order by id desc limit 8";
  $query = mysql_query($sql);
  while ($rs = mysql_fetch_array($query)) {
    $_id = $rs['owner'];
    $_sql = "SELECT * FROM `user` where `id` = $_id";
    $_query = mysql_query($_sql);
    while ($_rs = mysql_fetch_array($_query)) $owner = array(
      'id' => $_rs['id'],
      // 'name' => $_rs['name'],
      'nick' => $_rs['nick'],
      // 'gender' => $_rs['gender'],
      // 'phone' => $_rs['phone'],
      // 'contact' => $_rs['contact'],
      // 'validity' => $_rs['validity'],
      // 'last_login' => $_rs['last_login'],
      // 'date' => $_rs['date'],
      // 'city' => $_rs['city'],
      // 'language' => $_rs['language'],
      // 'introduction' => $_rs['introduction'],
      'avatar' => $_rs['avatar'],
    );
    $issue[] = array(
      'id' => $rs['id'],
      'owner' => $owner,
      'title' => $rs['title'],
      'text' => $rs['text'],
      'image' => $rs['image'],
      'likes' => $rs['likes'],
      'comments' => $rs['comments'],
      'visits' => $rs['visits'],
      'validity' => $rs['validity'],
      'time' => $rs['time'],
      'thumb' => $rs['thumb'],
    );
  }
  
  print_r(json_encode($issue));
  mysql_close($link);

?>